//
//  LaunchViewController.m
//  MyMovie
//
//  Created by apple on 16/5/20.
//  Copyright © 2016年 ljp. All rights reserved.
//

#import "LaunchViewController.h"
#import "CustomTabBarController.h"

@interface LaunchViewController ()

@end

@implementation LaunchViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self loadImageView];
    [self showImageView];

}

- (void)loadImageView {


    for (int i = 1; i <= 24; i++) {

        UIImageView *imageView = [self.view viewWithTag:i];
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d", i]];
        imageView.alpha = 0;
    }
}
- (BOOL)prefersStatusBarHidden {
    return YES;
}
- (void)showImageView {

    for (int i = 1; i <= 24; i++) {
        UIImageView *imageView = [self.view viewWithTag:i];
        [UIView animateWithDuration:0.3
                              delay:(i-1)*0.1
                            options:UIViewAnimationOptionLayoutSubviews
                         animations:^{
                             imageView.alpha = 1;
                         }completion:^(BOOL finished){
                             if (i == 24) {
                                 [self jumpToMain];
                             }
                         }];
    }
}

- (void)jumpToMain {

    CustomTabBarController *custom = [[CustomTabBarController alloc] init];
    self.view.window.rootViewController = custom;
    custom.view.transform = CGAffineTransformMakeScale(0.2, 0.2);
    [UIView animateWithDuration:0.5 animations:^{
        custom.view.transform = CGAffineTransformIdentity;
    }];
}

@end
